﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using glTech.Log4netWrapper;
using Nancy;
using Newtonsoft.Json;
using FutianCloudAPIService.Domains;

namespace FutianCloudAPIService.Handler
{
    public class RecognizeModule : RavenModule
    {
        public RecognizeModule(RecognizeDomain regdomain)
            : base("recog")
        {
            Post["/bsscard", true] = async (x, ct) =>
            {
                // 识别名片信息,并返回json
                var repFiles = this.Request.Files.Select(o => o.Value).ToList();
                string repImage = this.Request.Form.image;

                Logger.LogInfo("recog card " + repImage);
                return await regdomain.RecogCard(repFiles, repImage);
            };
        }
    }
}
